const { DataTypes } = require('sequelize')

const sequelize = require('../db/sequelize')

const User = sequelize.define("nk_user", {
    // id 自动创建
    user_name: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
        comment: '用户名，唯一'
    },
    password: {
        type: DataTypes.CHAR(128),
        allowNull: false,
        comment: '密码'
    },
    is_admin: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: 0,
        comment: '是否为管理员,0不是 1是'
    }
}, {
    timestamps: true //时间戳字段
})

// 强制数据库
// User.sync({ focus: true })

module.exports = User